﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UnwiseSource.ServiceReference1;

namespace UnwiseSource
{
    public class GenerateHtml
    {
        public static string GenerateCourse(v_Courses course, string language)
        {
            string result = "";
            string startDate = "";
            string endDate = "";
            string lecturesPerWeek = "";
            string lectors = "";

            if(language == "bg")
            {
                startDate = "Начална дата:";
                endDate = "Крайна дата:";
                lecturesPerWeek = "Лекции на седмица:";
                lectors = "Лектори:";
            }
            else if(language == "en")
            {
                startDate = "Start date:";
                endDate = "End date:";
                lecturesPerWeek = "Lectures per week:";
                lectors = "Lectors:";
            }

                string startDateValue = "";
                string endDateValue = "";
                string lecturesPerWeekValue = "";
                if (course.StartDate != null) startDateValue = course.StartDate.Value.ToString("dd.MM.yyyy");
                if (course.EndDate != null) endDateValue = course.EndDate.Value.ToString("dd.MM.yyyy");
                if (course.LecturesPerWeek != null) lecturesPerWeekValue = course.LecturesPerWeek.Value.ToString();
                
                result += "<div class=\"course-holder\"><article class=\"course\"><div class=\"course-main\"><div class=\"level-" + course.LevelName + "\"></div>" +
                                "<h1>" + course.CourseName + "</h1>" +
                            "</div>" +
                            "<div class=\"info-holder\">" +
                                "<div class=\"option-hlder\">" +
                                    "<p>" + startDate + "</p>" +
                                    "<p class=\"start-date\">" + startDateValue + "</p>" +
                                "</div>" +
                                "<div class=\"option-hlder\">" +
                                    "<p>" + endDate + "</p>" +
                                    "<p class=\"end-date\">" + endDateValue + "</p>" +
                                "</div>" +
                                "<div class=\"option-hlder\">" +
                                    "<p>" + lecturesPerWeek + "</p>" +
                                    "<p class=\"num-lectures\">" + lecturesPerWeekValue +"</p>" +
                                "</div>" +
                                "<div class=\"option-hlder\">" +
                                    "<p>" + lectors + "</p>" +
                                    "<p class=\"place\">";
                foreach (var lector in course.Lectors)
	            {
		            result+= lector + ", ";
	            }
                result += "</p>" +
                                "</div>" +
                            "</div>" +
                            "<div class=\"summary-holder\">" +
                                "<p>" + course.SummaryContent + "</p>" +
                            "</div>" +
                        "</article>" +
                    "</div>";

            return result;
        }

        public static string GenerateLecture(v_Lectures lecture, string lang)
        {
            string pppTitle;
            string videoTitle;
            string materialsTitle;
            if (lang == "bg")
            {
                pppTitle = "Презантация";
                videoTitle = "Видео";
                materialsTitle = "Материали";
            }
            else
            {
                pppTitle = "Presentation";
                videoTitle = "Video";
                materialsTitle = "Materials";
            }

            string lectureHtml = "<div class=\"course-holder\"><article class=\"course\"><div class=\"course-main\">"+
                                "<h1>" + lecture.LectureName + "</h1>" +
                            "</div>" +
                            "<div class=\"info-holder\">" +
                "<div style=\"width:500px; display:inline-block; padding-left:10px;\"><p style=\"padding-left:20px; font-weight:100;\">" + lecture.SummaryContent + "<p></div>" +
                "<div style=\"width:130px; height:120px; float:right;\"><a target=\"_blank\" href=\"" + lecture.MaterialsUrl + "\" class=\"lecture_img_btns lecture_yellow_img_btn\" title=\"" + pppTitle +"\" ></a>" +
                "<a target=\"_blank\" href=\"" + lecture.PresentationUrl + "\" class=\"lecture_img_btns lecture_red_img_btn\" title=\"" + videoTitle + "\" ></a>" +
                "<a target=\"_blank\" href=\"" + lecture.VideoUrl + "\" class=\"lecture_img_btns lecture_blue_img_btn\" title=\"" + materialsTitle + "\" ></a></div>" +
                "</div></article></div>";

            return lectureHtml;
        }
    }
}